using Android.Content;
using Android.Database.Sqlite;


namespace MuseumsBC.DataAccess
{
    public class MuseumDatabaseHelper : SQLiteOpenHelper
    {
        private const string DATABASE_NAME = "MuseumsBC";
        private const int DATABASE_VERSION = 1;

        public MuseumDatabaseHelper(Context context)
            : base(context, DATABASE_NAME, null, DATABASE_VERSION)
        {
        }

        public override void OnCreate(SQLiteDatabase db)
        {
            db.ExecSQL(@"
                    CREATE TABLE Museum (
                        Address TEXT,
                        ChinCode TEXT,        
                        ChinUrl TEXT,       
                        Contents TEXT,        
                        Description TEXT,
                        HoursOfOperation TEXT,
                        Id  INTEGER PRIMARY KEY AUTOINCREMENT,
                        Image TEXT,
                        Latitude DOUBLE,
                        Longitude DOUBLE,
                        MuseumName TEXT,
                        Telephone TEXT,
                        Title TEXT,
                        Web TEXT
                    )");

//            db.ExecSQL(@"
//                    CREATE TABLE Museum (
//                        Id INTEGER PRIMARY KEY AUTOINCREMENT,
//                        Title TEXT NOT NULL,
//                        Contents TEXT NOT NULL,
//                        MuseumName TEXT
//                    )");
        }

        public override void OnUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
        {
            db.ExecSQL("DROP TABLE IF EXISTS Museum");

            OnCreate(db);
        }
    }
}